using UnityEngine;
using System.Collections;

public class Shield : MonoBehaviour
{
    public ShieldClass sClass;
    public float damageDivisor;
    public float blockedDivisor;
    public float disabledWait;
    // Use this for initialization
    void Start()
    {

    }
    public float decreaseDamage(float damage, Weapon weapon)
    {
        if (disabledWait > 0)
        {
            return damage;
        }
        if (weapon.blockedByShieldClass == sClass)
        {
            return damage / blockedDivisor;
        }
        if (weapon.disableShieldClass == sClass)
        {
            disabledWait = weapon.disableShieldClassTimespan;
        }
        return damage / damageDivisor;
    }
    public void disable(float time)
    {
        disabledWait = time;
    }
    private void decreaseDisabledWait()
    {

        disabledWait -= Time.deltaTime;
        if (disabledWait < 0)
        {
            disabledWait = 0;
        }
    }
    // Update is called once per frame
    void FixedUpdate()
    {

    }
}
